{
gboolean ret = FALSE;
g_autoptr(GBytes) summary_data = NULL;
- g_autoptr(GFile) summary_file = NULL;
g_autoptr(GFile) signature_path = NULL;
g_autoptr(GVariant) existing_signatures = NULL;
g_autoptr(GVariant) new_metadata = NULL;
guint i;
signature_path = g_file_resolve_relative_path (self->repodir, "summary.sig");
- summary_file = g_file_resolve_relative_path (self->repodir, "summary");
- summary_data = gs_file_map_readonly (summary_file, cancellable, error);
+ summary_data = ot_file_mapat_bytes (self->repo_dir_fd, "summary", error);
if (!summary_data)
goto out;
out:
return ret;
}
+
+GBytes *
+ot_file_mapat_bytes (int dfd,
+ const char *path,
+ GError **error)
+{
+ glnx_fd_close int fd = openat (dfd, path, O_RDONLY | O_CLOEXEC);
+ g_autoptr(GMappedFile) mfile = NULL;
+
+ if (fd < 0)
+ {
+ glnx_set_error_from_errno (error);
+ return FALSE;
+ }
+
+ mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
+ if (!mfile)
+ return FALSE;
+
+ return g_mapped_file_get_bytes (mfile);
+}